<!--#Include File="../conn.asp" -->
<!--#Include File="../include/inc.asp"-->
<!--#Include File="../include/md5.asp"-->
<%
'====================================================================
'= Team Elite - Elite Article System
'= Copyright (c) 2005 - 2006 Eason Chan All Rights Reserved.
'=-------------------------------------------------------------------
'= 版权协议：
'=	GPL (The GNU GENERAL PUBLIC LICENSE Version 2, June 1991)
'=-------------------------------------------------------------------
'= 文件名称：Member/Login.asp
'= 摘    要：会员-登陆文件
'=-------------------------------------------------------------------
'= 最后更新：eason007
'= 最后日期：2005-06-16
'====================================================================

Dim Action
Action=Request.QueryString ("action")

Select Case LCase(Action)
Case "login"
	Call Chk_Login
Case "logout"
	Call Get_Logout
Case Else
	Call Main
End Select
EA_Pub.Close_Obj
Set EA_Pub=Nothing

Sub Chk_Login
	Call EA_Pub.Chk_Post
	
	Dim Login_Accout,Login_Password,SaveTime
	Dim Mem_Info(4)
	Dim TempArray,i,Key,Temp
	
	Login_Accout=EA_Pub.SafeRequest(2,"username",1,"",1)
	Login_Password=EA_Pub.SafeRequest(2,"password",1,"",-1)
	Login_Password=MD5(Login_Password)
	SaveTime=EA_Pub.SafeRequest(2,"savetimes",0,0,0)
	
	Temp=EA_DBO.Get_MemberLogin(Login_Accout)
	If Not IsArray(Temp) Then Call EA_Pub.ShowErrMsg(18,1)
	If Temp(1,0)<>Login_Password Then Call EA_Pub.ShowErrMsg(36,1)
	If Temp(2,0)<>1 Then Call EA_Pub.ShowErrMsg(3,1)
	
	EA_Pub.Mem_Info(0)=Temp(0,0)
	EA_Pub.Mem_Info(1)=Login_Accout
	EA_Pub.Mem_Info(2)=Temp(3,0)
	EA_Pub.Mem_Info(3)=Temp(4,0)
	
	Call EA_Pub.Get_Member_GroupSetting(EA_Pub.Mem_Info(3))
	
	If EA_Pub.Mem_GroupSetting(1)="0" Then Call EA_Pub.ShowErrMsg(37,1)

	If EA_Pub.Mem_GroupSetting(5)="1" Then 
		If EA_Pub.Chk_SystemTimer(EA_Pub.Mem_GroupSetting(4)) Then Call EA_Pub.ShowErrMsg(38,1)
	End If
	
	Randomize
	Key=CStr(Int((999999-1+100000)*Rnd+1))
	
	EA_Pub.Mem_Info(4)=Key
	EA_Pub.Mem_Info(5)=EA_Pub.Mem_GroupSetting(0)

	Session("UserData")=Join(EA_Pub.Mem_Info,",")
	Response.Cookies("UserData")=Session("UserData")

	If SaveTime=10 Then Response.Cookies("UserData").Expires=Date()+720

	Call EA_DBO.Set_MemberLoginKey(EA_Pub.Get_UserIp,Key,EA_Pub.Mem_Info(0))

	Call EA_Pub.ShowSusMsg(4,1)
End Sub

Sub Get_Logout()
	Session("UserKey")=Empty
	Session("UserData")=Empty
	
	Response.Cookies("UserData")=Empty
	
	Response.Redirect SystemFolder
End Sub

Sub Main()
%>
<html>
<head>
<title>会员登陆</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="zh-CN">
<link href="style.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
var ie=(document.all)?true:false;
function sublogin(){
if(document.login.UserName.value==''||document.login.PassWord.value==''||document.login.PassWord.value.length<6||document.login.PassWord.value.length>14){
alert("请填写好您的用户名和密码再提交");
document.login.UserName.focus();
return true;
}else{document.login.submit();}
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000"> 
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> 
  <tr> 
    <td bgcolor="#FFFFFF"> <table border=0 cellpadding=3 cellspacing=2 width="100%" align=center> 
        <tr> 
          <td bgcolor="#dddddd" height="30">&nbsp;<b>会员登陆</b></td> 
        </tr> 
      </table> 
      <table width="762" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC"> 
        <tr> 
          <td bgcolor="#FFFFFF"><table width="760" border="0" align="center" cellpadding="0" cellspacing="0"> 
              <tr> 
                <td align="center" valign="top"> <table width="40%" border="0" align="center" cellpadding="4" cellspacing="1" class="TableBorder2_1"> 
                    <form action="?action=login" method="post" name="login" target="_self"> 
                      <tr> 
                        <td height="200" colspan="3" bgcolor="#F3F3F3" class="Top4"> <BLOCKQUOTE><font color="#000000">帐户</font> 
                            <input name="UserName" type="text" tabindex=1 class="LoginInput" id="UserName" size="20" maxlength="20" onKeyDown="readkey()"> 
                            <FONT color="#000000"> <FONT color="#FF0000">*</FONT><br> 
                            <BR> 
                            密码</FONT> 
                            <INPUT name="PassWord" type="password" class="LoginInput" tabindex=2 id="PassWord" size="20" maxlength="20" onKeyDown="readkey()"> 
                            <FONT color="#FF0000">*</FONT><br> 
                            <BR> 
                            <input name="SaveTimes" type="checkbox" id="SaveTimes" value="10"> 
                            保存密码<br> 
                            <BR> 
                            <INPUT type="button" name="Submit" class="LoginInput" value="登陆" onClick="sublogin()"> 
                            <INPUT name="Reg" type="button" class="LoginInput" id="Reg3" value="注册新用户" onClick="Javascript:location.href='Register.asp';"> 
                          </BLOCKQUOTE></td> 
                      </tr> 
                    </form> 
                  </table></td> 
              </tr> 
            </table></td> 
        </tr> 
      </table></td> 
  </tr> 
</table> 
<%
End Sub
%> 
